//
//  WCNConsultServiceController.m
//  WCN
//
//  Created by wsj2015 on 15/9/10.
//  Copyright (c) 2015年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCNConsultServiceController.h"
#import "Macros.h"
#import "WCNConsult_1Cell.h"
#import "WCNConsult2Cell.h"

@interface WCNConsultServiceController ()<UITableViewDataSource,UITableViewDelegate>
{
    UITableView *_tableView;
}
@end

@implementation WCNConsultServiceController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor =kAppBg;
    self.title =@"护理咨询";
    [self configUI];
   
    
    
}

-(void)configUI
{
    _tableView =[[UITableView alloc]initWithFrame:CGRectMake(0, 17, kScreenWidth, 300) style:UITableViewStylePlain];
    _tableView.delegate =self;
    _tableView.dataSource=self;
    _tableView.separatorColor =kBorderColor;
    _tableView.alwaysBounceVertical =NO;
    [self.view addSubview:_tableView];


}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSInteger num =0;
    if (section == 0) {
        num =4;
    }else{
        num =1;
    }
    return num;


}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *superCell;
    if (indexPath.section ==0 ) {
        WCNConsult_1Cell *cell =[WCNConsult_1Cell cellWithTableView:tableView nibName:@"WCNConsult_1Cell"];
        if (indexPath.row ==1|| indexPath.row == 3) {
            cell.accessoryType =UITableViewCellAccessoryNone;
            [cell isShowSwitch:YES];
            cell.titleLabel.text =@"服务开关";
        }
        if (indexPath.row == 0) {
            cell.titleLabel.text =@"服务单价";
            cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
            [cell isShowSwitch:NO];
        }else if (indexPath.row ==2){
            cell.titleLabel.text =@"包周单价";
            cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
            [cell isShowSwitch:NO];
        }
        
        superCell =cell;
    }else{
        WCNConsult2Cell *cell =[WCNConsult2Cell cellWithTableView:tableView nibName:@"WCNConsult2Cell"];
        superCell =cell;
        cell.backgroundColor =[UIColor yellowColor];
        
    }
    
    superCell.selectionStyle =UITableViewCellSelectionStyleNone;
    
    return superCell;
 
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CGFloat h;
    if (indexPath.section ==0) {
        h =45;
    }else{
        h =100;
    }
    return h;

}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    NSInteger  h =0;
    if (section == 1) {
        h =15;
    }
    return h;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view =nil;
    if (section ==1) {
        UIView *spaceView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
        spaceView.backgroundColor =kAppBg;
        view = spaceView;
    }
    return view;
  
}
@end
